package main

import (
	"fmt"
	"sync"
)

//全局变量
var value int

// 等待组
var wg sync.WaitGroup

func main() {
	wg.Add(3)
	go run()
	go run()
	go run()
	wg.Wait()
	fmt.Println(value)
}

func run() {
	for i := 0; i < 100000; i++ {
		value++
	}
	wg.Done()
}
